// this file is intended to be included only from Vector.h.
#ifndef RS_POINT3_C_H
#define RS_POINT3_C_H


namespace rs
{

inline Point3::Point3()
{
}


inline Point3::Point3(f32 x0, f32 y0, f32 z0)
: x(x0), y(y0), z(z0), w(1.0f)
{
}


inline Point3::Point3(const Point3& rhs)
{
	x = rhs.x;
	y = rhs.y;
	z = rhs.z;
	w = rhs.w;
}


inline Point3& Point3::operator=(const Point3& rhs)
{
	x = rhs.x;
	y = rhs.y;
	z = rhs.z;
	w = rhs.w;

	return *this;
}


inline Point3& Point3::operator+=(const Vector3& rhs)
{
	x += rhs.getX();
	y += rhs.getY();
	z += rhs.getZ();

	return *this;
}


inline Point3& Point3::operator-=(const Vector3& rhs)
{
	x -= rhs.getX();
	y -= rhs.getY();
	z -= rhs.getZ();

	return *this;
}


inline void Point3::set(f32 x0, f32 y0, f32 z0)
{
	x = x0;
	y = y0;
	z = z0;
}


inline f32 Point3::getX() const { return x; }
inline f32 Point3::getY() const { return y; }
inline f32 Point3::getZ() const { return z; }


inline Point3 operator+(const Vector3& lhs, const Point3& rhs)
{
	Point3 p = rhs;
	p += lhs;
	return p;
}


inline Point3 operator+(const Point3& lhs, const Vector3& rhs)
{
	Point3 p = lhs;
	p += rhs;
	return p;
}


inline Vector3 operator-(const Point3& lhs, const Point3& rhs)
{
	return Vector3(
		lhs.getX() - rhs.getX(),
		lhs.getY() - rhs.getY(),
		lhs.getZ() - rhs.getZ()
	);
}

} // namespace rs


#endif // ifndef RS_POINT3_C_H
